package com.xuexiang.xuidemo.item;

import ohos.media.image.common.Rect;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

public class ImageViewInfo implements Sequenceable {

    /**
     * 图片预览实体类
     */
    private String mUrl;  //图片地址
    private String mVideoUrl;
    private Rect mBounds; // 记录坐标
    private String mDescription = "描述信息";

    public ImageViewInfo() {

    }

    public ImageViewInfo(String url) {
        mUrl = url;
    }

    public ImageViewInfo(String videoUrl, String url) {
        mUrl = url;
        mVideoUrl = videoUrl;
    }

    public ImageViewInfo(String mUrl, String mVideoUrl, String mDescription) {
        this.mUrl = mUrl;
        this.mVideoUrl = mVideoUrl;
        this.mDescription = mDescription;
    }

    public String getUrl() {//将你的图片地址字段返回
        return mUrl;
    }

    public void setUrl(String url) {
        mUrl = url;
    }


    public String getVideoUrl() {
        return mVideoUrl;
    }

    public Rect getmBounds() {
        return mBounds;
    }

    public void setmBounds(Rect mBounds) {
        this.mBounds = mBounds;
    }

    public void setVideoUrl(String videoUrl) {
        mVideoUrl = videoUrl;
    }

    public String getmDescription() {
        return mDescription;
    }

    public void setmDescription(String mDescription) {
        this.mDescription = mDescription;
    }

    public boolean marshalling(Parcel out) {
        return out.writeString(mUrl) && out.writeString(mVideoUrl);
    }

    //从包裹中读取数据
    public boolean unmarshalling(Parcel in) {
        this.mUrl = in.readString();
        this.mVideoUrl = in.readString();
        return false;    //注意Uri类型的写法和普通数据类型有所不同
    }

    //序列化对象的内部构造器，必须实现
    public static final Sequenceable.Producer
            PRODUCER = new Sequenceable.Producer
            () {
        public ImageViewInfo createFromParcel(Parcel in) {    //从包裹中获取数据构造对象
            ImageViewInfo instance = new ImageViewInfo();
            instance.unmarshalling(in);
            return instance;
        }   //必须实现Producer
    };

}
